package cn.mini.mybatis.mybatis.session.defaults;

import cn.mini.mybatis.mybatis.executor.Executor;
import cn.mini.mybatis.mybatis.session.Configuration;
import cn.mini.mybatis.mybatis.session.SqlSession;
import cn.mini.mybatis.mybatis.session.SqlSessionFactory;

public class DefaultSqlSessionFactory implements SqlSessionFactory {


    private Configuration configuration;

    public DefaultSqlSessionFactory(Configuration configuration) {
        this.configuration = configuration;
    }


    @Override
    public SqlSession openSession() {
        final Executor executor = configuration.newExecutor();
        return new DefaultSqlSession(configuration,executor);
    }
}
